using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._WorkflowManagerTools._Jobs
{
    /// <summary>
    /// <para>Create New Jobs</para>
    /// <para>Creates one or more jobs of the selected job type and assigns the jobs to a user or user group. The created jobs can be prioritized and assigned a polygon or point location of interest (LOI).</para>
    /// <para>创建所选作业类型的一个或多个作业，并将作业分配给用户或用户组。可以对创建的作业进行优先级排序，并为其分配一个面或感兴趣点位置 （LOI）。</para>
    /// </summary>    
    [DisplayName("Create New Jobs")]
    public class CreateNewJobs : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public CreateNewJobs()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_Input_DatabasePath">
        /// <para>Input Database Path (.jtc)</para>
        /// <para>The Workflow Manager (Classic) database connection file that contains the job type information. If no connection file is specified, the current default Workflow Manager (Classic) database is used.</para>
        /// <para>包含作业类型信息的 Workflow Manager （Classic） 数据库连接文件。如果未指定连接文件，则使用当前默认的 Workflow Manager （Classic） 数据库。</para>
        /// </param>
        /// <param name="_Job_Type">
        /// <para>Job Type</para>
        /// <para>The job type to be used for creating the new job.</para>
        /// <para>用于创建新作业的作业类型。</para>
        /// </param>
        /// <param name="_Number_of_Jobs">
        /// <para>Number of Jobs</para>
        /// <para>The number of jobs to be created. This input is ignored if LOI Extent has a value or if Merge features to create one LOI is checked.</para>
        /// <para>要创建的作业数。如果 LOI 范围具有值，或者选中了合并要素以创建一个 LOI，则忽略此输入。</para>
        /// </param>
        public CreateNewJobs(object _Input_DatabasePath, object _Job_Type, long? _Number_of_Jobs)
        {
            this._Input_DatabasePath = _Input_DatabasePath;
            this._Job_Type = _Job_Type;
            this._Number_of_Jobs = _Number_of_Jobs;
        }
        public override string ToolboxName => "Workflow Manager Tools";

        public override string ToolName => "Create New Jobs";

        public override string CallName => "wmx.CreateNewJobs";

        public override List<string> AcceptEnvironments => [];

        public override object[] ParameterInfo => [_Input_DatabasePath, _Job_Type, _Number_of_Jobs, _Assignment_Type, _Assign_To, _Priority, _Feature_Layer_LOI, _Union.GetGPValue(), _Job_ID];

        /// <summary>
        /// <para>Input Database Path (.jtc)</para>
        /// <para>The Workflow Manager (Classic) database connection file that contains the job type information. If no connection file is specified, the current default Workflow Manager (Classic) database is used.</para>
        /// <para>包含作业类型信息的 Workflow Manager （Classic） 数据库连接文件。如果未指定连接文件，则使用当前默认的 Workflow Manager （Classic） 数据库。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Database Path (.jtc)")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Input_DatabasePath { get; set; }


        /// <summary>
        /// <para>Job Type</para>
        /// <para>The job type to be used for creating the new job.</para>
        /// <para>用于创建新作业的作业类型。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Job Type")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Job_Type { get; set; }


        /// <summary>
        /// <para>Number of Jobs</para>
        /// <para>The number of jobs to be created. This input is ignored if LOI Extent has a value or if Merge features to create one LOI is checked.</para>
        /// <para>要创建的作业数。如果 LOI 范围具有值，或者选中了合并要素以创建一个 LOI，则忽略此输入。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Jobs")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public long? _Number_of_Jobs { get; set; }


        /// <summary>
        /// <para>Assignment Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the assignment type to use to assign new jobs. If no value is specified, the default value configured in the job type is used.</para>
        ///   <bulletList>
        ///     <bullet_item>Groups—The new jobs will be assigned to a group.</bullet_item><para/>
        ///     <bullet_item>Users— The new jobs will be assigned to a user.</bullet_item><para/>
        ///     <bullet_item>Unassigned—The new jobs will be unassigned.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定用于分配新作业的工作分配类型。如果未指定任何值，则使用作业类型中配置的默认值。</para>
        ///   <bulletList>
        ///     <bullet_item>组 - 新作业将分配给一个组。</bullet_item><para/>
        ///     <bullet_item>用户 — 新作业将分配给用户。</bullet_item><para/>
        ///     <bullet_item>未分配—新作业将取消分配。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Assignment Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Assignment_Type { get; set; } = null;


        /// <summary>
        /// <para>Assigned To</para>
        /// <para>The user or group to whom the new jobs will be assigned. The value is restricted to a user or group based on the selected assignment type.</para>
        /// <para>将向其分配新作业的用户或组。该值根据所选分配类型限制为用户或组。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Assigned To")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Assign_To { get; set; } = null;


        /// <summary>
        /// <para>Priority</para>
        /// <para>The priority of the jobs that will be created. If no priority is specified, the default value configured in the job type is used.</para>
        /// <para>将创建的作业的优先级。如果未指定优先级，则使用作业类型中配置的默认值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Priority")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Priority { get; set; } = null;


        /// <summary>
        /// <para>LOI Extent</para>
        /// <para>The polygon, point, or multipoint features whose geometry will be used to create the LOI of the new jobs. One job will be created for each feature in the layer unless Merge features to create one LOI is checked.</para>
        /// <para>面、点或多点要素，其几何将用于创建新作业的 LOI。除非选中合并要素以创建一个 LOI，否则将为图层中的每个要素创建一个作业。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("LOI Extent")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Feature_Layer_LOI { get; set; } = null;


        /// <summary>
        /// <para>Merge features to create one LOI</para>
        /// <para><xdoc>
        ///   <para>Specifies whether one job will be created with the union of all polygons, point, or multipoint in the input feature layer as the LOI of the job.
        ///   <bulletList>
        ///     <bullet_item>Checked—One union polygon or multipont feature will be generated from the LOI features and one job will be created regardless of the input number of jobs.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—Each feature in the input layer will be used to generate the LOI of one job. The total number of jobs created is equal to the total number of input features. This is the default.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定是否将输入要素图层中所有面、点或多点的并集作为作业的 LOI 创建一个作业。
        ///   <bulletList>
        ///     <bullet_item>选中—将从 LOI 要素生成一个并集面或多路要素，并且无论输入的作业数如何，都将创建一个作业。</bullet_item><para/>
        ///     <bullet_item>未选中 - 输入图层中的每个要素将用于生成一个作业的 LOI。创建的作业总数等于输入要素的总数。这是默认设置。 </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Merge features to create one LOI")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _Union_value? _Union { get; set; } = null;

        public enum _Union_value
        {
            /// <summary>
            /// <para>UNION</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("UNION")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_UNION</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_UNION")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Job ID</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Job ID")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public List<object> _Job_ID { get; set; }


        public CreateNewJobs SetEnv()
        {
            base.SetEnv();
            return this;
        }

    }

}